package com.captainbank.tcl.tclapplication.ui.views;

import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.captainbank.tcl.tclapplication.R;
import com.captainbank.tcl.tclapplication.utils.MyToast;

/**
 * Created by TCL on 2019/4/4.
 * Describe:
 */
public class ShowDialogFragment extends DialogFragment {

    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        LayoutInflater layoutInflater = getActivity().getLayoutInflater();
        View view = layoutInflater.inflate(R.layout.view_show_dialog_fragment,null);

        TextView tv_info = view.findViewById(R.id.tv_info);
        tv_info.setText("提示信息！");

        builder.setView(view)
                .setTitle("标题")
                .setPositiveButton("确认", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        MyToast.toastNormal(getActivity(),"确认");
                    }
                })
                .setNegativeButton("取消", null)
                ;
        return  builder.create();
    }
}
